import {defineConfig} from 'vite';

import path from 'path';


export default defineConfig({
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./src"),
      "@styles": path.resolve(__dirname, "./src/styles"),
      "@comp": path.resolve(__dirname, "./src/components"),
      "@route": path.resolve(__dirname, "./src/routes"),
      "@view": path.resolve(__dirname, "./src/views"),
      "@layout": path.resolve(__dirname, "./src/layouts")
    }
  },
  server: {
    proxy: {
      '/api/icons': {
        target: 'https://favicon.im',  // 后端API地址
        changeOrigin: true,  // 是否修改请求头中的Origin
        rewrite: (path) => path.replace(/^\/api\/icons/, '/icons'), // 重写路径
      },
    },
  },
});